<?php
Yii::import('application.vendors.fpdf.*');
require('fpdf.php');

/**
 * Prints an invoice as a PDF file
 *
 * @param   int     $id             Invoice PK
 * @param   bool    $print_address  TRUE, if customer address shall be printed. FALSE else
 */

function __($text) { return $text; }

//Instanciation of inherited class
$pdf = new InvoicePDF( );
if(isset($_GET['invoice'])) {
    foreach($_GET['invoice'] as $key=>$value) {
        $pdf->$key = $value;
    }
} elseif(Yii::app()->user->companySettings->invoicePDFSettings!=='') {
    $pdfSettings = unserialize(Yii::app()->user->companySettings->invoicePDFSettings);
    foreach($pdfSettings as $key=>$value) {
        $pdf->$key = $value;
    }
}

$pdf->SetDisplayMode('fullpage', 'single');
$pdf->settings = unserialize($content);
$pdf->company = $pdf->settings->company;
$pdf->vehicle = $pdf->settings->vehicle;
$pdf->party = $pdf->settings->party;
$pdf->invoice = $pdf->settings->invoice;
$pdf->invoice->invoiceCurrency = ' '.trim($pdf->invoice->invoiceCurrency);
$pdf->invoiceItems = $pdf->settings->invoice->items;
$pdf->AliasNbPages();
$pdf->AddPage();
$pdf->SetFont('Arial','',12);
$pdf->render();

// vim: set expandtab tabstop=4 shiftwidth=4 fdc=4 foldmethod=marker: 
?>
